<template>
	<view>
		<view class="group-list">
			<view class="group-item" v-for="(item, index) in data" :key="index" @click="jump_to_different_methods(index)">
				<image :src="item.image" class="group-item-image"></image>
				<view class="group-content-right">
					<view class="group-item-title">{{ item.title }}</view>
					<view class="group-item-content">{{ item.content }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			data: []
		}
	},
	onLoad() {
		this.get_app_info();
	},
	methods: {
		async get_app_info() {
			let get_app_info = await this.$api.get_app_info({});
			if (get_app_info.code == 1) {
				this.data = get_app_info.data.app_exten_info.group;
			}
		},
		jump_to_different_methods(index) {
			if (this.data[index].type == 0) {
				uni.setClipboardData({
					data: this.data[index].url_data,
					success: function () {
						uni.showToast({
							title: '复制成功',
							icon: 'none'
						})
					}
				});
				plus.runtime.openURL("weixin://");
			} else if (this.data[index].type == 1) {
				plus.runtime.openURL('mqq://im/chat?chat_type=wpa&version=1&src_type=web&uin=' + this.data[index].url_data);
			} else {
				uni.navigateTo({
					url: '/pages/common/webview?url=' + encodeURIComponent(this.data[index].url_data)
				})
			}

		}
	}
}
</script>

<style lang="less">
.group-list {
	display: flex;
	flex-direction: column;

	.group-item {
		display: flex;
		flex-direction: row;
		padding: 20upx;
		border-bottom: 1upx solid #eee;

		.group-item-image {
			width: 100upx;
			height: 100upx;
			border-radius: 50%;
			margin-right: 20upx;
		}

		.group-content-right {
			display: flex;
			flex-direction: column;
			justify-content: center;

			.group-item-title {
				font-size: 32upx;
				color: #333;
			}

			.group-item-content {
				font-size: 28upx;
				color: #666;
				margin-top: 10upx;
			}
		}
	}
}
</style>
